package com.tm.chargecar.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tm.chargecar.entity.ReDaCenterEntity;
import com.tm.chargecar.entity.RecordEntity;
import com.tm.chargecar.vo.RecordVo;
import com.tm.chargecar.mapper.ReDaCenterMapper;
import com.tm.chargecar.mapper.RecordMapper;
import com.tm.chargecar.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RecordServiceImpl extends ServiceImpl<RecordMapper, RecordEntity> implements RecordService {
   @Autowired
   private RecordMapper recordMapper;
    @Autowired
    private ReDaCenterMapper reDaCenterMapper;
    @Override
    public List<RecordEntity> queryRecord(RecordVo recordVo) {
        List<RecordEntity> list  =   recordMapper.queryRecord(recordVo);

        for (int i = 0; i < list.size(); i++) {
            ReDaCenterEntity reDaCenter=  reDaCenterMapper.queryReDaCenterSelect(list.get(i));
            ReDaCenterEntity reDaCenter2=  reDaCenterMapper.queryReDaCenterSelectT(list.get(i));
            list.get(i).setDuiZhichu(reDaCenter.getDuiZhichu());
            list.get(i).setZhichuCount(reDaCenter.getZhichuCount());
            list.get(i).setDuiShouru(reDaCenter2.getDuiShouru());
            list.get(i).setShouruCount(reDaCenter2.getShouruCount());
        }
        return list;
    }
}
